<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>领导审核列表</title>
    <link rel="stylesheet" href="../../layui/css/layui.css" media="all">
    <script src="../../res/js/jquery-3.4.1.min.js" type="text/javascript"
            charset="utf-8"></script>
    <script src="../../js/login_common.js" charset="utf-8"></script>
    <script src="../../layui/layui.js" charset="utf-8"></script>
    <script>
        $.ajaxSetup({
            async : false
        });
        layui.use('laydate', function(){
            var laydate = layui.laydate;

            //常规用法
            laydate.render({
                elem: '#stime'
                ,type: 'datetime'
            });
            //常规用法
            laydate.render({
                elem: '#etime'
                ,type: 'datetime'
            });
        });
        $(function(){
            $("#seachTable").on("click",function(){
                //执行重载
                //带条件查询
                table2.reload({
                    url: '../../../RecoveryAtsSchemeController/selectStateAll',
                    where: {
                        saName: $("#saName").val(),
                        stime: $("#stime").val(),
                        etime: $("#etime").val()
                    },
                    page: { curr: 1 }
                });
            })
        });
    </script>
</head>
<body style="padding: 5px;">
<div class="demoTable">
    搜索：
    <div class="layui-inline">
        <input class="layui-input" name="saName" id="saName" placeholder="方案关键字搜索" autocomplete="off">
    </div>
    <div class="layui-input-inline">
        <input type="text" class="layui-input" id="stime" name="stime" placeholder="请输入开始日期" >
    </div>
    <div class="layui-input-inline">
        <input type="text" class="layui-input" id="etime" name="etime"  placeholder="请输入结束日期" >
    </div>
    <input type="button" id="seachTable" class="layui-btn layui-btn-normal" value="搜索" />
</div>
    <table class="layui-hide" id="test" lay-filter="test"></table>

    <script>

        var table2=null;
        layui.use('table', function(){
            var table = layui.table;
            table2= table.render({
                elem: '#test'
                ,url:'../../../RecoveryAtsSchemeController/selectStateAll'
                ,toolbar: '#toolbarDemo'
                ,title: '审核方案'
                ,cols: [[
                    {field:'saName', title:'方案名称', width:160}
                    ,{field:'remark', title:'申请理由', width:220}
                    ,{toolbar: '#state', title:'审核状态', width:150}
                    ,{field:'creater', title:'创建人', width:120, sort: true}
                    ,{field:'creatTime', title:'创建时间', width:160}
                    ,{fixed: 'right', title:'操作', toolbar: '#barDemo', width:120}
                ]]
                ,page: true//开启分页
            });
            //监听行工具事件
            table.on('tool(test)', function(obj){
                var data = obj.data;
                if(obj.event === 'edit'){
                    var data1 = obj.data;//获取当前行
                    //iframe层
                    layer.open({
                        type: 2,
                        title: '申请审核咨询页面',
                        shadeClose: true,
                        skin: 'layui-layer-molv', // 样式类名
                        shade: 0.8,
                        area: ['500px', '300px'],
                        content: 'RecoveryAtsSchemeAuditShenhe.html?id='+data1.saId //iframe的url
                    });
                }

            });


        });
    </script>
<script type="text/html" id="barDemo">
    {{#
    if(d.auditState <= "10" ){
    }}
    <a class="layui-btn layui-btn-xs" lay-event="edit">审核</a>
    {{# }else{ }}
    <button class="layui-btn layui-btn-disabled layui-btn-xs layui-icon layui-icon-edit " lay-event="edit" disabled="disabled">审核</button>
    {{# } }}
</script>
<script type="text/html" id="state">
    {{#
    if(d.auditState == "10" ){

    }}
    <h5 style="color: #00F7DE">申请</h5>
    {{# } }}
    {{#
    if(d.auditState == "20" ){

    }}
    <h5 style="color: skyblue">中心领导已同意</h5>
    {{# } }}
    {{#
    if(d.auditState == "21" ){

    }}
    <h5 style="color: red">中心领导不同意</h5>
    {{# } }}
    {{#
    if(d.auditState == "30" ){

    }}
    <h5 style="color: #00F7DE">专家已获知待回复</h5>
    {{# } }}
    {{#
    if(d.auditState == "40" ){

    }}
    <h5 style="color: #00F7DE">专家已回复</h5>
    {{# } }}
</script>
</body>
</html>